package cn.loioi.util.page.datatable.request;

import cn.loioi.util.page.datatable.DataTableUitl;

/**
 * <br>
 * (c) Copyright 2016 by <br>
 * @description :DataTable请求的字段列表 <br>
 * @file_name :DataTableColumn.java <br>
 * @system_name :cmp-web <br>
 * @author :yyzh <br>
 * @创建时间 :2016年8月24日 下午4:11:06
 */
public class DataTableColumn {

	private String data;
	private String name;
	private Boolean searchable;
	private Boolean orderable;
	private DataTableSearch search;

	public String getData() {
		return data;
	}

	public void setData(String data) {
		this.data = data;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Boolean getSearchable() {
		return searchable;
	}

	public void setSearchable(Boolean searchable) {
		this.searchable = searchable;
	}

	public Boolean getOrderable() {
		return orderable;
	}

	public void setOrderable(Boolean orderable) {
		this.orderable = orderable;
	}

	public DataTableSearch getSearch() {
		return search;
	}

	public void setSearch(DataTableSearch search) {
		this.search = search;
	}

	public void setValue(String[] key, String value) {
		if ("data".equals(key[2])) {
			this.data = value;
		} else if ("name".equals(key[2])) {
			this.name = value;
		} else if ("searchable".equals(key[2])) {
			this.searchable = DataTableUitl.parseBoolean(value);
		} else if ("orderable".equals(key[2])) {
			this.orderable = DataTableUitl.parseBoolean(value);
		} else if ("search".equals(key[2])) {
			if (this.search == null) {
				this.search = new DataTableSearch();
			}
			this.search.setValue(key[3], value);
		}
	}
}
